package com.issc.main;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.issc.bean.Post;
import com.issc.bean.User;
import com.issc.jdbc.DateBaseUtli;

public class Main {


	
	public boolean insertUser(User user){
		
		boolean flag = false;
		String name = user.getName();
		String password = user.getPassword();
		String repassword = user.getRepassword();
		String email = user.getEmail();
		DateBaseUtli db = new DateBaseUtli();
		Connection conn=db.getConnection();
		String sql = "insert into user (name,password,repassword,email) values (?,?,?,?)";
		try {
			PreparedStatement ps = conn.prepareStatement(sql);
			ps.setString(1, name);
			ps.setString(2, password);
			ps.setString(3, repassword);
			ps.setString(4, email);
			int i = ps.executeUpdate();
			if(i>0){
				flag = true;
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return false;
		
	}
	
	public List<Post> selectpost(String name){
		List<Post> list = new ArrayList<Post>();
		return list;
		
	}

}
